using System.Collections;
using UnityEngine;

public class Plant : MonoBehaviour, IFood
{
	[Header("Data")]
	public Food food;

	[Header("Requirement")]
	public Animation animation;

	public Collider2D collider;

	public new Transform transform;

	protected IEnumerator Grow()
	{
		collider.enabled = false;
		transform.localScale = Vector3.zero;
		yield return Engine.growingTime;
		animation.Play();
		yield return new WaitForSeconds(animation["grow"].length);
		collider.enabled = true;
	}

	public Food Eat()
	{
		OnEnd();
		return food;
	}

	public bool IsDangerous(Creature creature)
	{
		return false;
	}

	public bool IsEatable(Creature creature)
	{
		return true;
	}

	public Vector2 GetPosition()
	{
		return transform.position;
	}

	public float GetSize()
	{
		return 1f;
	}

	protected virtual void OnEnd()
	{
	}
}
